package com.zmn.plat.admin.controller.part.category.second;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.zmn.common.dto.LayuiTableResponseDTO;
import com.zmn.common.dto.VtDTO;
import com.zmn.plat.admin.controller.part.PartBaseController;
import com.zmn.plat.model.entity.part.PartCategory;
import com.zmn.plat.model.entity.part.PartCategoryQuery;

/**
 * @Auther: admin
 * @since: 2018/10/16 11:23
 * @Description:
 */

@RestController
@RequestMapping("/part/category/second/ajax")
public class PartCategorySecondAjaxController extends PartBaseController {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @SuppressWarnings("Duplicates")
    @RequestMapping(value = "/list", produces = "application/json; charset=utf-8")
    public LayuiTableResponseDTO partCategoryList(PartCategoryQuery query) {

        List<PartCategory> partCategoryList = partCategoryService.listPageByQuery(query);
        return LayuiTableResponseDTO.success(query.getTotalCount(), partCategoryList);
    }

    @RequestMapping(value = "/select", produces = "application/json; charset=utf-8")
    public List<VtDTO> select(@RequestParam Integer value) {

        List<VtDTO> categSimpleList = partCategoryService.getPartCategorySimpleList(value);

        return categSimpleList;
    }

}
